<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;

## Import Joomla Data
jimport('joomla.application.component.view');

class JooSamViewRequest extends JView{
	
	## Protected form vars
	protected $form;
	protected $item;

	public function display($tpl = null){
		
		## Get Data
		$form = $this->get('Form');
		$item = $this->get('Item');
		$samcat  = $this->get('SamCat');
 
		## Check Errors
		if (count($errors = $this->get('Errors'))){
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}

		## Links
		$this->form = $form;
		$this->item = $item;
		$this->samcat = $samcat;
		
		## Set toolbar & Document
		$this->addToolBar();
		$this->setDocument();
 
		## Display
		parent::display($tpl);
	}
	
	## Toolbar
	protected function addToolBar(){
		
		JRequest::setVar('hidemainmenu', true);
		$canDo	= JoosamHelper::getActions();
		JToolBarHelper::title(JText::_('COM_JOOSAM_VIEW_REQUEST_TITLEBAR'), 'request-title-logo'); // build the toolbar with name (Main)
		if ($canDo->get('core.edit')) {
			JToolBarHelper::save('request.save');
		}
		JToolBarHelper::cancel('request.cancel');
	}
	
	## Document
    protected function setDocument(){
        
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_JOOSAM_VIEW_REQUEST_TITLE'));
		$document->addScript(JURI::root() . "administrator/components/com_joosam/javascript/jscolor/jscolor.js");
		$document->addStyleDeclaration('.icon-48-request-title-logo{
											background-image:url(../media/com_joosam/images/request.Title.Logo.png);
											background-position:10px 1px;
											padding-left:160px !important;
										}
										.jsamLegend{
											border-radius:10px;
										}
		');
	}

}
?>